#!/usr/bin/python
# -*- coding:utf-8 -*-
# @author  : micah
# @time    :  
# @function: 
# @version :


class StudentSystem:
    # 构造函数
    def __init__(self):
        self.stu_list = []
        # 计数器
        self.current = 0

    def add_student(self):
        name = input('请输入学生姓名：')
        tel = input('请输入学生手机号：')
        address = input('请输入学生地址：')

        new_stu_dict = dict()
        new_stu_dict['name'] = name
        new_stu_dict['tel'] = tel
        new_stu_dict['address'] = address

        self.stu_list.append(new_stu_dict)

    # 迭代对象
    def __iter__(self):
        return self

    # 迭代器对象
    def __next__(self):
        # 迭代规则
        if self.current < len(self.stu_list):
            res = self.stu_list[self.current]
            self.current += 1
            return res
        else:
            raise StopIteration


# 创建实例对象
stu_obj = StudentSystem()

for _ in range(3):
    stu_obj.add_student()

# 输出所有学生信息
for item in stu_obj:
    print(item)
